/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package EvoAlg;

import java.awt.Color;
import java.awt.Graphics;
import java.util.ArrayList;
import javax.swing.JPanel;
import javax.swing.border.Border;

/**
 *
 * @author Geost1gma
 */
public class Graph extends JPanel {

    double[] max;
    double[] min;
    double[] avg;

    ArrayList<Double> data = new ArrayList<Double>();

    int xSize = 1000;
    int ySize = 400;

    public Graph(){
        setSize(xSize, ySize);
        setVisible(true);
        setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
       

    }

    @Override
    protected void paintComponent(Graphics g) {
        super.paintComponent(g);
        g.setColor(Color.BLACK);


        int heightFactor = this.getHeight();
        int widthFactor  = this.getWidth()/1000;

        for (int i = 0; i < max.length-1; i++) {
            //System.out.println(max[i]);
            //System.out.println();
            g.setColor(Color.BLACK);
            //System.out.println("max" + max[i]);
            g.drawLine(i,getHeight() - (int)(max[i]+300), i+1,getHeight() - (int)(max[i+1]+300));
            if(i%5 == 0) g.drawLine(i, 100 , i+1, 100);
            //g.drawLine(i*widthFactor,heightFactor -(int)(heightFactor*max[i]),(i+1)*widthFactor,heightFactor -(int)(heightFactor*max[i+1]));
         
//            g.setColor(Color.RED);
//            g.drawLine(i*widthFactor,heightFactor -(int)(heightFactor*min[i]),(i+1)*widthFactor,heightFactor -(int)(heightFactor*min[i+1]));
//            g.setColor(Color.BLUE);
//            g.drawLine(i*widthFactor,heightFactor -(int)(heightFactor*avg[i]),(i+1)*widthFactor,heightFactor -(int)(heightFactor*avg[i+1]));
        }
    }

    public double[] getAvg() {
        return avg;
    }

    public void setAvg(double[] avg) {
        this.avg = avg;
    }

    public double[] getMax() {
        return max;
    }

    public void setMax(double[] max) {
        this.max = max;
    }

    public double[] getMin() {
        return min;
    }

    public void setMin(double[] min) {
        this.min = min;
    }

    public int getxSize() {
        return xSize;
    }

    public void setxSize(int xSize) {
        this.xSize = xSize;
    }

    public int getySize() {
        return ySize;
    }

    public void setySize(int ySize) {
        this.ySize = ySize;
    }

    


}
